package com.song.elasticsearch.controller;

import com.song.elasticsearch.config.redis.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/redis")
public class RedisController {
    @Autowired
    private RedisUtil redisUtil;
    @PostMapping("/set")
    public void set(String key, int seconds, String value){
        redisUtil.set(key, seconds, value);
    }

    @GetMapping("/get")
    public String get(String key){
        return redisUtil.get(key);
    }
}
